
#ifndef SCREEN_TURBOSCREEN_H
#define SCREEN_TURBOSCREEN_H

#include <QObject>
#include <QSize>
#include <QPoint>

class TurboScreen : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QPoint pos_left_up_ READ getPosLeftUp WRITE setPosLeftUp USER true);
    Q_PROPERTY(QPoint pos_right_down_ READ getPosLeftUp WRITE setPosLeftUp USER true);
    Q_PROPERTY(QPoint mouse_start_pos_ READ getMouseStartPos WRITE setMouseStartPos USER true);
    Q_PROPERTY(QPoint mouse_end_pos_ READ getMouseEndPos WRITE setMouseEndPos USER true);
    Q_PROPERTY(int max_width_ READ getMaxWidth WRITE setMaxWidth USER true);
    Q_PROPERTY(int max_height_ READ getMaxHeight WRITE setMaxHeight USER true);
public:
    enum STATUS
    {
        emSELECT,
        emMOV,
        emDRAW
    };
    explicit TurboScreen(QObject *parent = 0);
    explicit TurboScreen(const QSize &size, QObject *parent = 0);
    ~TurboScreen() override;

    void setPosLeftUp(const QPoint &point);
    QPoint getPosLeftUp();

    void setPosRightDown(const QPoint &point);
    QPoint getPosRightDown();

    void setMouseStartPos(const QPoint &point);
    QPoint getMouseStartPos();

    void setMouseEndPos(const QPoint &point);
    QPoint getMouseEndPos();

    void setMaxWidth(const int &value);
    int getMaxWidth();

    void setMaxHeight(const int &value);
    int getMaxHeight();

    void setStatus(const STATUS &status);
    STATUS getStatus();

    bool checkIsInArea(const QPoint &pos);
    void move(const QPoint &p);

protected:
    void comparePoints(QPoint &leftTop, QPoint &rightDown);

private:
    QPoint            pos_left_up_;
    QPoint            pos_right_down_;
    QPoint            mouse_start_pos_;
    QPoint            mouse_end_pos_;
    int               max_width_{0};
    int               max_height_{0};
    STATUS            status_;
};

#endif //SCREEN_TURBOSCREEN_H
